// 引入 react 依赖
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Text, View, Image, TouchableOpacity, ImageBackground, ScrollView,InteractionManager } from 'react-native';

// 引入第三方依赖
import _ from 'lodash';
import pureRender from 'pure-render-decorator';

// antd 按需加载
import { } from '@ant-design/react-native';

// 引入 处理数据 所需文件
import { } from './module.js'

// 引入样式
import Styles from './style.js';

// 引入公用组件
import { } from '../../components/index.js'

// 引入工具包
import { press, size, ScreenWidth , defaultDataList,onEndReached,onRefresh ,concatDataList,defaultPage} from '../../util/utils.js'
class Card extends Component {
	static propTypes = {

	}

	constructor(props) {
		super(props)
		this.state = {}
	}

	renderFooter() {
		const { data, type, renderFooter } = this.props
		return <Text style={{ fontSize: size(28), color: '#ffe300', lineHeight: size(32), }}>￥{data.tk_Amount || data.Amount}</Text>
	}

	render() {
		const { data, renderFooter, isFooter, width, height, style } = this.props
		return (
			<View style={style}>
				<View style={{
					width: width || size(630),
					flexDirection: 'column',
					borderRadius: size(12),
					overflow: 'hidden',
				}}>
					<Image
						resizeMode='cover'
						style={{
							width: width || size(630),
							height: height || size(225),
							zIndex: 1

						}}
						source={{ uri: data.tk_Photo || data.cardPic || data.EquityPhoto }}
					/>
					<View style={{
						flexDirection: 'row',
						marginTop: -5,
						marginBottom: -5,
						alignItems: 'center',
						zIndex: 10
					}}>
						<View style={{
							width: 10,
							height: 10,
							borderRadius: 6,
							backgroundColor: '#fff',
							marginLeft: -5
						}} />
						<View style={{
							height: 2,
							backgroundColor: '#fff',
							flex: 1
						}} />
						<View style={{
							width: 10,
							height: 10,
							borderRadius: 6,
							backgroundColor: '#fff',
							marginRight: -5

						}} />
					</View>
					<View
						style={{
							padding: 15,
							backgroundColor: data.kb_color,
							zIndex: 1
						}}>
						<Text style={{ fontSize: 16, color: '#fff', lineHeight: 18, textAlign: 'center' }}>卡片权益</Text>
						{data.yhq_list.map((item, index) => {
							return (
								<View
									key={index}
									style={{
										flexDirection: 'row',
										alignItems: 'center',
										marginTop: 10,
										marginBottom: 10
									}}
								>
									<Text style={{ fontSize: 14, color: '#fff', lineHeight: 16, }}>{item.type_1}</Text>
									<Text style={{ fontSize: 14, color: '#fff', lineHeight: 16, marginHorizontal: 10 }}>|</Text>
									<Text style={{ fontSize: 14, color: '#fff', lineHeight: 16, }}>{item.yhq_title}</Text>
								</View>
							)
						})}
					</View>
					{isFooter!==false ? (
						<View style={{
							height: size(90),
							justifyContent: 'space-between',
							flexDirection: 'row',
							alignItems: 'center',
							paddingHorizontal: 15,
							backgroundColor: '#3a3a3a'
						}}>
							<Text style={{
								fontSize: size(32),
								color: '#ffe300',
								lineHeight: size(36),
							}}>{data.EquityName}</Text>
							{renderFooter ? renderFooter : this.renderFooter()}
						</View>
					) : null}
				</View>
			</View>
		)
	}
}

export default pureRender(Card)
